<template>
    <div class="forget-wrap">
        <div class="ms-forget">
            <div class="ms-title">秒秒后台管理系统找回密码</div>
            <el-form :model="param" :rules="rules" ref="forget" label-width="0px" class="ms-content">


                <el-form-item prop="email">
                    <el-input v-model="param.password" placeholder="请输入新密码">
                        <el-button slot="prepend" icon="el-icon-phone"></el-button>
                    </el-input>
                </el-form-item>
                 
                
                <div class="forget-btn">
                    <el-button type="primary" @click="submitForm()">提交</el-button>
                </div>
               
            </el-form>
        </div>
    </div>
</template>

<script>
import { updatepassword_get } from '../../api/api.js'
export default {
    data: function() {
        return {
            param: {
                password: '',
            },
            rules: {
                password: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
                
            },

            // 获取tokens
            tokens:'',
        };
    },
    created() {
        this.tokens = this.$route.query.tokens
        console.log(this.tokens)
    },
    methods: {
        submitForm() {
            var params = {
                password:this.param.password,
                tokens:this.tokens
                
            };
            
            // 找回密码请求
            updatepassword_get(params).then(res => {
                if(res.code==200){
                    this.$message(res.message)                      
                    this.$router.push('/login')
                }else{
                    this.$message(res.message)  
                }
            
                
            })
        },
        
    },
};
</script>

<style scoped>
.forget-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: url(../../assets/img/login-bg.jpg);
    background-size: 100%;
}
.ms-title {
    width: 100%;
    line-height: 50px;
    text-align: center;
    font-size: 20px;
    color: #fff;
    border-bottom: 1px solid #ddd;
}
.ms-forget {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 350px;
    margin: -190px 0 0 -175px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
}
.ms-content {
    padding: 30px 30px;
}
.forget-btn {
    text-align: center;
}
.forget-btn button {
    width: 100%;
    height: 36px;
    margin-bottom: 10px;
}
.forget-tips {
    font-size: 12px;
    line-height: 30px;
    color: #fff;
}
</style>